
const requests = (options) => {

	return new Promise((resolve, reject) => {
		uni.request({
			...options,
			header: {
				'content-type': 'application/json'
			},
			dataType: 'json',
			success: (res) => {
				if (res.state === 0) {
					return uni.showToast({
						title: '数据获取失败'
					})
				}
				resolve(res)
			},
			fail: (err) => {
				uni.showToast({
					title: '请求接口失败'
				})
			reject(err)
			
			}
		})
	})
}
export default requests